package cn.stylefeng.guns.modular.business.frequency.orderpickassigndriver.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.business.frequency.orderpickassigndriver.service.OrderPickAssignDriverService;
import cn.stylefeng.guns.modular.business.frequency.orderpickassigndriver.model.param.OrderPickAssignDriverParam;

import javax.annotation.Resource;

/**
 * tt_order_pick_assign_driver 控制器
 *
 * @author: yujie
 * @date: 2023/05/09 17:16
 */
@RestController
public class OrderPickAssignDriverController {

    @Resource
    private OrderPickAssignDriverService orderPickAssignDriverService;

    /**
     * 分页查询tt_order_pick_assign_driver
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderPickAssignDriver/page")
    @BusinessLog(title = "tt_order_pick_assign_driver_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(OrderPickAssignDriverParam orderPickAssignDriverParam) {
        return new SuccessResponseData(orderPickAssignDriverService.page(orderPickAssignDriverParam));
    }

    /**
     * 获取全部tt_order_pick_assign_driver
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderPickAssignDriver/list")
    @BusinessLog(title = "tt_order_pick_assign_driver_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(OrderPickAssignDriverParam orderPickAssignDriverParam) {
        return new SuccessResponseData(orderPickAssignDriverService.list(orderPickAssignDriverParam));
    }

    /**
     * 查看详情tt_order_pick_assign_driver
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderPickAssignDriver/detail")
    @BusinessLog(title = "tt_order_pick_assign_driver_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(OrderPickAssignDriverParam.detail.class) OrderPickAssignDriverParam orderPickAssignDriverParam) {
        return new SuccessResponseData(orderPickAssignDriverService.detail(orderPickAssignDriverParam));
    }

    /**
     * 添加tt_order_pick_assign_driver
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderPickAssignDriver/add")
    @BusinessLog(title = "tt_order_pick_assign_driver_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(OrderPickAssignDriverParam.add.class) OrderPickAssignDriverParam orderPickAssignDriverParam) {
        orderPickAssignDriverService.add(orderPickAssignDriverParam);
        return new SuccessResponseData();
    }

    /**
     * 删除tt_order_pick_assign_driver
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderPickAssignDriver/delete")
    @BusinessLog(title = "tt_order_pick_assign_driver_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(OrderPickAssignDriverParam.delete.class) OrderPickAssignDriverParam orderPickAssignDriverParam) {
        orderPickAssignDriverService.delete(orderPickAssignDriverParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑tt_order_pick_assign_driver
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderPickAssignDriver/edit")
    @BusinessLog(title = "tt_order_pick_assign_driver_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(OrderPickAssignDriverParam.edit.class) OrderPickAssignDriverParam orderPickAssignDriverParam) {
        orderPickAssignDriverService.edit(orderPickAssignDriverParam);
        return new SuccessResponseData();
    }


}
